package org.mspring.mlog.dao.impl;

import java.util.List;

import org.mspring.mlog.dao.TagDao;
import org.mspring.mlog.entity.Tag;
import org.mspring.platform.dao.hibernate.GenericDao;
import org.springframework.stereotype.Repository;

/**
 * @author Gao Youbo
 * @since 2014年3月9日
 */
@Repository
public class TagDaoImpl extends GenericDao<Tag, Long> implements TagDao {

    @Override
    public List<Tag> listLikeByName(String name) {
        return list("select tag from Tag tag where tag.name like ?", name + "%");
    }

    @Override
    public Tag findByName(String name) {
        return uniqueResult("select tag from Tag tag where tag.name = ?", name);
    }
}
